<table class="subjectsTable">
<tr>
	<th colspan="2">Predmety</th>	
</tr>
<?php foreach($this->block as $block):?>
	<?php foreach($block->getSubjects() as $subject):?>
	<tr id="<?php echo  $block->bid . '-' . $subject->sid; ?>">
		<td><?php echo $subject->name ?></td>
		<td class="center">
					<a class="actionIcon deleteAction" href="#" onClick="javascript:$.post(
						'<?= $this->url(array(
							'controller' => 'block',
							'action' => 'remove-subject',
							'format' => 'html' 
						)
					) ?>',
					{
						bid: <?php echo $block['bid']; ?>,
						sid: <?php echo $subject['sid'] ?>,						
					},
					function(result){						
						$('.message').html(result);						
						$('table.subjectsTable tr#<?php echo  $block->bid . '-' . $subject->sid; ?>').remove();
					});">Odstrániť</a>	
		</td>	
	</tr>
	<?php endforeach;?>
<?php endforeach;?>
</table>
<div class="bottom">
	<?php echo $this->form; ?>
</div>
<br/><br/>
<table class="groupsTable">
	<tr>
		<th colspan="2">Odbory</th>
	</tr>	
	<?php foreach($this->groups as $block):?>
		<?php foreach($block->getTTridys() as $group):?>
		<tr id="<?php echo $block->bid . '-' . $group->ID_tr; ?>">
			<td><?php echo $group->getZkratka() ?></td>
			<td class="center">
					<a class="actionIcon deleteAction" href="#" onClick="javascript:$.post(
						'<?= $this->url(array(
							'controller' => 'block',
							'action' => 'remove-group',
							'format' => 'html' 
						)
					) ?>',
					{
						bid: <?php echo $block['bid']; ?>,
						ID_tr: <?php echo $group['ID_tr'] ?>,						
					},
					function(result){						
						$('.message').html(result);						
						$('table.groupsTable tr#<?php echo  $block->bid . '-' . $group->ID_tr; ?>').remove();
					});">Odstrániť</a>	
		</td>
		</tr>
		<?php endforeach;?>
	<?php endforeach;?>
</table>
<div class="bottom">
	<?php echo $this->addGroupForm; ?>
</div>